package com.aos.erp.manager.rest.index;


import com.aos.erp.common.bean.ResultEntity;
import com.aos.erp.manager.service.index.IndexQueryService;
import com.aos.erp.manager.util.UserUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 傲雄端，首页数据查询
 * </p>
 *
 * @author 杨文博
 * @since 2018-12-02
 */
@Slf4j
@RestController
@RequestMapping("/api/index")
@Api(value="傲雄端，首页数据查询",tags={"傲雄端，首页数据查询"})
public class IndexQueryController {

	@Autowired
	private IndexQueryService indexQueryService;


	@PostMapping("/totalStudent")
	@ApiOperation(value = "获取全国学员报名数量")
	public ResultEntity selectTotalStudent(String currentUserId) throws Exception {
		UserUtil.getUserDepCode(currentUserId);
		Long count=indexQueryService.selectTotalStudent();
		return ResultEntity.success(count);
	}


	@PostMapping("/studentByCityCode")
	@ApiOperation(value = " 根据城市Code查询学员")
	@ApiImplicitParam(name = "cityCode",value = "城市Code",required = true,dataType ="String",paramType ="query" )
	public ResultEntity studentByCityCode(String cityCode,String currentUserId) throws Exception {
		UserUtil.getUserDepCode(currentUserId);
		Long count=indexQueryService.studentByCityCode(cityCode);
		return ResultEntity.success(count);
	}



}

